package com.andaily.web.controller.validator;

import com.andaily.domain.dto.log.LogTypeDto;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

/**
 * @author Shengzhao Li
 */
public class LogTypeValidator implements Validator {

    @Override
    public boolean supports(Class<?> clazz) {
        return LogTypeDto.class.equals(clazz);
    }

    @Override
    public void validate(Object target, Errors errors) {
        ValidationUtils.rejectIfEmpty(errors, "name", null, "名称不能为空");
    }
}
